Fix: Send device discovery notifications when contact list is full#1369
Fix: Send device discovery notifications when contact list is full#1369agessaman wants to merge 2 commits intomeshcore-dev:devfrom
Conversation
…full When the contact list reaches MAX_CONTACTS, the radio now creates a temporary ContactInfo and calls onDiscoveredContact() to notify the app, matching the behavior of manual-add mode. This ensures the app always receives discovery notifications even when the contact table is full. Removed unused shouldNotifyAboutNewContacts() method.
Updated the onDiscoveredContact method to always send discovery notifications for new contacts, regardless of the auto-add setting. This change ensures consistent behavior in contact handling.
|
I just took a look at the potential impacts on meshcore_py for @fdlamotte.
I don't think there are any code changes necessary to implement.
People writing client code will need to deduplicate NEW_CONTACT events, but I'm guessing that's already implemented to prevent repeated notifications when auto-add is turned off. |
|
This looks good, I like the refactor. 👌 |
|
I just double checked the logic in my PR and it looks like I already implemented this, you must have telepathic powers or something 😂 MeshCore/src/helpers/BaseChatMesh.cpp Lines 134 to 139 in b23e622 |
|
Indeed you did. It needed doing, and I'm glad it is getting done. I'll leave this here and close it out when yours gets merged. |
#1379 got merged btw |
Fix: Send device discovery notifications when contact list is full
Problem
When the contact list reached MAX_CONTACTS, new device discoveries were ignored and the app was not notified. This behavior is particularly frustrating for new users who miss out on mesh discovery because of a full contacts list.
Solution
When the table is full, create a temporary
ContactInfoand callonDiscoveredContact()to notify the app, matching manual-add mode behavior and sendPUSH_CODE_NEW_ADVERTwith the full contact info allowing the Discovery List to continue to populate.Changes
BaseChatMesh::onAdvertRecv(): Whennum_contacts >= MAX_CONTACTS, create a temporaryContactInfoand callonDiscoveredContact()instead of returning early.MyMesh::onDiscoveredContact(): Remove check for!isAutoAddEnabled()and send full contact ifis_newis true.Behavior
ContactInfousingPUSH_CODE_NEW_ADVERTPUSH_CODE_NEW_ADVERT(existing behavior, unchanged)Connection checks remain in
onDiscoveredContact().